LPTSER page# 0001 next
2: COMMENT ⊗   VALID 00020 PAGES
3: C REC  PAGE   DESCRIPTION
4: C00001 00001
5: C00004 00002    BEGIN LPTSER ↔ SUBTTL LINE PRINTER SERVICE ROUTINE
6: C00005 00003     LPT PARAMETER ASSIGNMENTS
7: C00007 00004       LPT SERVICE DISPATCH TABLE
8: C00008 00005     INITIALIZE LINE PRINTER - CALLED FOR 200 RESTARTS
9: C00011 00006     LPT OUTPUT CODE, LPT MAY BE RUNNING NOW
10: C00014 00007     SEE IF USER HAS A FREE BUFFER TO BE FILLING
11: C00016 00008     COME HERE IF LINE PRINTER IS HUNG
12: C00019 00009     THIS PART OF THE PROGRAM BRINGS A BUFFERLOAD INTO SYSTEM CORE
13: C00021 00010     TRANSFER BUFFERLOAD CHARACTER BY CHARACTER
14: C00023 00011     ROUTINE TO DEPOSIT ONE BYTE IN THE SYSTEM BUFFER
15: C00026 00012    LPTMCR: PUSH PDP,A               SAVE CURRENT CHARACTER
16: C00027 00013     BASIC LEVEL DEPOSIT BYTE AND WRAP AROUND POINTER
17: C00028 00014     CHARACTER CONVERSION TABLE
18: C00029 00015     MORE CHARACTER TABLE, CHARACTERS 51 TO 123
19: C00030 00016     MORE CHARACTER CONVERSION TABLE, CHARACTERS 124 TO 177
20: C00031 00017            SUBTTL LPTSER - JAM 25 SEPT 1968 - INTERRUPT LEVEL ROUTINES
21: C00035 00018     COME HERE WHEN THERE IS NOT A FULL WORD TO BE PRINTED
22: C00036 00019    LPTCRF: CONO    LPT,LPTCHB+LPTDON+LPTALT        SET ALT FLAG
23: C00038 00020     THIS PART HANDLES THE ERROR SYSTEM
24: C00040 ENDMK
25: C⊗;
    LPTSER page# 0002 next  prev
27: BEGIN LPTSERSUBTTL LINE PRINTER SERVICE ROUTINE
28: ; NEW LINE PRINTER SERVICE ROUTINES - JAM 25 SEPT 68
29: ; NEVER SETS IOACT BIT IN IOS
30: ; DOES CHARACTER CONVERSION EXCEPT WHEN 100 BIT IN RH OF IOS IS ON
31: ; FEATURES INTERNAL BUFFERING
32: ; USERS BUFFERS ARE NOT ENTIRELY EMPTIED UNTIL HE DOES THE 'CLOSE' UUO
    LPTSER page# 0003 next  prev
34: ; LPT PARAMETER ASSIGNMENTS
35: 
36: ; LPT CONTROL REGISTER
37:         LPTSTR←←100000          ;"PRESS START" AFTER IO RESET
38:         LPTALT←←4000            ; LAST CHAR WAS 177 (HARDWARE BIT)
39:         LPTCLR←←2000            ; CLEAR LPT HARDWARE REGISTERS!
40:         LPTDON←←100             ; ENABLE LPT DONE FLAG
41:         LPTERR←←400             ; ENABLE LPT ERROR INTERRUPT
42:         LPTLOV←←1000            ; LINE OVERFLOW, WON'T OCCUR
43:         LPTCHB←←LPTCHN*11       ; PUTS PI CHANNEL NUMBER IN READY
44:                                 ; INTERRUPT AND ERROR INTERRUPT SPOTS
45:         LPTCLB←←LPTCHN+200      ; CLEAR CHANNEL
46: 
47: ; ACCUMULATOR DEFINITIONS . . .
48:         A←TAC
49:         B←TAC1
50:         C←AC1
51:         D←DAT
52:         COUNT←AC2
53:         POINTR←AC3
54: 
55: ; RH OF LPT IOS WORD
56:         LPTNCC←←100             ; SET BY USER TO INHIBIT CHARACTER CONVERSION
57:         HNGTRP←←200             ; USER WANTS ERROR RETURN ON HUNG LPT.
58:         DELBIT←←400             ; LAST CHAR. BEFORE CONO-ING LPT OFF WAS 177
59: 
60: ; LH OF LPT IOS WORD
61:         LPTEN1←←200             ; NEAR END OF LPT ACTIVITY FLAG
62:         LPTDNG←←400             ; DANGLING 177 FLAG
63:         LPTERF←←4000            ; ERROR BUBBLING UP FROM INTERRUPT LEVEL
64:         LPTEN2←←20000           ;RELEASE BIT.
65: 
66: ; STORAGE PARAMETERS
67:         LPTCPL←←=120           ; NUMBER OF CHARACTERS PRINTED PER LINE
    LPTSER page# 0004 next  prev
69: ;   LPT SERVICE DISPATCH TABLE
70: 
71:         JRST LPTINI             ;INITILIZE
72:         JRST LPTCLT             ;LPT HUNG TIMEOUT. SET ERROR BIT IN IOS FOR LPTOUT TO SEE.
73: LPTDSP:
74:         JRST LPTREL             ;RELEASE LPT
75:         JRST LPTCLS             ;CLOSE
76:         JRST LPTOUT             ;OUTPUT
77:         JRST ILLINP             ;INPUT
    LPTSER page# 0005 next  prev
79: ; INITIALIZE LINE PRINTER - CALLED FOR 200 RESTARTS
80: 
81: LPTINI: CONO    LPT,LPTSTR      ; SET LPT START FLAG
82:         SETOM   LPTBG1          ;SET FLAG DENOTING FIRST LPT OPERATION
83: LPTI.1: MOVEI   IOS,0
84:         CONO    LPT,LPTCLR      ;CLEAR HARDWARE REGISTERS.
85:         HLLZS   LPTCON          ;CLEAR PI DISPATCH ADDRESS FOR NOW
86:         PUSHJ   P,LPTINZ        ; INITIALIZE BYTE POINTERS
87:         SETZM   LPTIBF          ;SET TO ZERO OUT INTERNAL BUFFER
88:         MOVE    TAC,[XWD LPTIBF,LPTIBF+1]
89:         BLT     TAC,LPTDCN
90:         POPJ    P,              ; RETURN TO SENDER, ADDRESS UNKNOWN
91:                                 ; NO SUCH NUMBER, NO SUCH ZONE
92: LPTBI:  POINT 7,LPTIBF          ; LPTUBP - UUO LEVEL SYSTEM BUFFER BYTE POINTER
93:         LPTIBF                  ; LPTIBP - INTERRUPT LEVEL POINTER
94:         5*LPTBLN                ; LPTCC - TOTAL NUMBER OF FREE CHARACTERS IN SYSTEM BUFFER
95:         LPTCPL                  ; LPTLCC - CHARACTER POSITION IN LINE
96: 
97: ; LINE PRINTER CLOSE CODE
98: 
99: LPTCLS: HRLZI IOS,IOEND         ; SET OUR PRIVATE 'LAST UUO' FLAG
100:         ORB IOS,DEVIOS(DEVDAT)  ; OR IN BIT TO HONEST IOS
101:         TLNN IOS,LPTERF         ; ARE WE HUNG?
102:         JRST OUT                ; NO, DO LOTS OF OUTPUTS
103:         MOVSI IOS,LPTERF
104:         ANDCAB IOS,LPTIOS       ; CLEAR ERROR BIT
105:         PUSHJ PDP,LPTHN         ; CALL THE HUNG ROUTINE
106:         JRST OUT                ; NOW DO SOME OUTPUTS
107: 
108: ; INITIALIZE IOS AND BYTE POINTERS
109: ; AND ALL THE CRAZY COUNTS
110: 
111: LPTINZ: MOVE    TAC,[XWD LPTBI,LPTUBP]
112:         BLT     TAC,LPTLCC              ;BLT IN POINTERS AND COUNTS
113:         ANDI    IOS,HNGTRP!LPTNCC!17    ;CLEAR ALL BUT MODE&SPECIAL BITS
114:         TLO     IOS,IO                  ;
115:         MOVEM   IOS,LPTIOS              ;AND STORE IOS
116:         SETZM   LPTDCN
117:         POPJ    P,
118: 
119: LPTREL: TLNE IOS,IOBEG          ;HAVE WE DONE ANYTHING YET
120:         JRST LPTI.1             ;NO
121:         HRLZI IOS,LPTEN2!IO     ;TELL SEVICE ROUTINE
122:         PUSHJ PDP,LPTO3         ;HE WILL SET THE WHEELS IN MOTION
123:         PUSHJ PDP,WSYNC         ;TREAD WATER A WHILE
124:         JRST LPTI.1             ;REFRESHING ISN'T IT.
    LPTSER page# 0006 next  prev
126: ; LPT OUTPUT CODE, LPT MAY BE RUNNING NOW
127: 
128: LPTOUT: TLZE IOS,IOBEG          ; FIRST UUO?
129:         PUSHJ PDP,LPTINZ                ;INITIALIZE LPT TABLES AND IOS
130:         TRZE IOS,IODERR         ; HAS LPT BEEN HUNG?
131:         JRST UNHANG             ; YES, UNHANG IT
132:         CONSO LPT,LPTERR                ;CATCH ERRORS NOW!
133:         TLZE IOS,LPTERF         ; CHECK FOR INTERRUPT LEVEL ERROR
134:         JRST LPTHNG             ; HANG USER UNTIL IT IS FIXED
135:         PUSHJ PDP,LPTSET        ; SEE IF WE CAN LOAD SYSTEM CORE
136:         JRST LPTO1              ; SYSTEM BUFFER EMPTY, RETURN TO USER
137:         TLNN IOS,IOEND          ; IS THIS THE LAST UUO?
138:         JRST LPTO2              ; NO, START LPT AND RETURN TO USER
139: 
140: LPTIOW: MOVEI A,LPTLOV+LPTERR+LPTDON
141:         HRLZI IOS,IO+IOW        ; SET IOS BITS TO SAY HE IS IN IO WAIT
142:         LDB C,PDVTIM            ; PICK UP HUNG COUNT TIME
143:         DPB C,PDVCNT            ; DEPOSIT IT, INITIATE HUNG COUNTING
144:         CONO PI,LPTOFF          ; DO OUR DIRTY WORK WITH CHANNEL 5 OFF
145:         HRRM A,LPTCON           ; SET UP DISPATCH BITS
146:         OR IOS,DEVIOS(DEVDAT)   ; PICK UP OUR IOS
147:         MOVEI A,0               ; ASSUME NO ALT!
148:         TRZE IOS,DELBIT         ; SHOULD BIT BE SET?
149:         TRO A,LPTALT            ; YES
150:         TLON IOS,DEVSBB         ; START LINE PRINTER IF IT IS NOT RUNNING
151:         CONO LPT,LPTCHB+LPTDON(A); SET ITS INTERRUPT CHANNEL AND ASK FOR DONE INTERRUPT
152:         MOVEM IOS,DEVIOS(DEVDAT)
153:         CONO PI,LPTON           ; THE LPT WILL INTERRUPT IMMEDIATELY
154:         PUSHJ PDP,WSYNC         ; DROP HIM INTO IO WAIT
155:         JRST LPTOUT             ; TRY ANOTHER OUTPUT WHEN WE RETURN
156: 
    LPTSER page# 0007 next  prev
158: ; SEE IF USER HAS A FREE BUFFER TO BE FILLING
159: ; RETURN TO HIM IF HE DOES, PUT HIM IN IO WAIT IF HE DOESN'T
160: 
161: LPTO2:  PUSHJ PDP,DEVCR         ; CHECK RING USE BIT
162:         JRST LPTIOW             ; IF BUSY, PUT HIM IN IO WAIT
163: 
164:         HRLZI IOS,IO            ; OTHERWISE, JUST START UP LPT
165: LPTO3:  MOVEI A,LPTLOV+LPTERR+LPTDON
166:         LDB C,PDVTIM            ; PICK UP HUNG COUNT TIME
167:         DPB C,PDVCNT            ; DEPOSIT IT, INITIATE  HUNG COUNTING
168:         CONO PI,LPTOFF          ; SHUT OFF LPT CHANNEL
169:         HRRM A,LPTCON           ; SET UP INTERRUPT DISPATCH CONI BITS
170:         OR IOS,DEVIOS(DEVDAT)   ; PICK UP OUR OWN IOS
171:         MOVEI A,0               ; ASSUME NOT BIT
172:         TRZE IOS,DELBIT         ; TRUE?
173:         TRO A,LPTALT            ; NO, SET BIT
174:         TLON IOS,DEVSBB         ; START LPT IF NEEDED
175:         CONO LPT,LPTCHB+LPTDON(A); GIVE IT A PAIR OF CHANNELS AND A DONE BIT
176:         MOVEM IOS,DEVIOS(DEVDAT)
177:         CONO PI,LPTON           ; RESTORE CHANNEL 5
178:         POPJ PDP,               ; RETURN TO USER, ADDRESS UNKNOWN
179:                                 ; NO SUCH NUMBER, NO SUCH ZONE!!
180: 
181: ; COME HERE IF THE SYSTEM BUFFER IS EMPTY
182: 
183: LPTO1:  TLNN IOS,IOEND          ; IS THIS THE LAST UUO?
184:         POPJ PDP,               ; NO, EXIT TO USER, STAGE LEFT
185:         HRLZI IOS,IOEND         ; AND NOW, ZERO THIS BIT FOR GOOD
186:         ANDCAB IOS,LPTIOS
187:         TLNE IOS,IOBEG          ; IS THIS REALLY THE BEGINNING?
188:         POPJ PDP,               ; YES, EXIT
189:         HRLZI IOS,IO+LPTEN1     ; TELL INTERRUPT SERVICE ROUTINES TO PRINT A CR-FF
190:         JRST LPTO3              ; START LPT AND LEAVE
191: 
    LPTSER page# 0008 next  prev
193: ; COME HERE IF LINE PRINTER IS HUNG
194: 
195: LPTHNG: TRNE IOS,HNGTRP         ;IS HE REQUESTING ERROR RETURN ON HUNG LPT
196:         JRST LPTHN1             ;YES
197:         PUSHJ PDP,LPTHN         ; HANG USER
198:         JRST LPTOUT             ; TRY AGAIN
199: 
200: LPTHN:  PUSHJ PDP,HNGSTP        ; PRINT OUT "DEVICE LPT OK?" AND HANG USER
201: UNHANG: MOVE IOS,[XWD LPTERF,IODERR]    ; SET TO CLEAR THE ERROR FLAGS
202:         MOVEI A,LPTLOV+LPTERR+LPTDON
203:         CONO PI,LPTOFF          ; SHUT OFF LPT
204:         HRRM A,LPTCON           ; SET UP CONI BITS
205:         ANDCAB IOS,DEVIOS(DEVDAT)
206:         TLO IOS,DEVSBB          ; SYSTEM BUFFER WILL NOW BE BUSY
207:         MOVEI A,0               ; ASSUME NO BIT
208:         TRZE IOS,DELBIT         ; TRUE?
209:         TRO A,LPTALT            ; NO, SET BIT
210:         CONO LPT,LPTCHB+LPTDON(A); START UP LPT
211:         MOVEM IOS,DEVIOS(DEVDAT)
212:         CONO PI,LPTON           ; RESTORE PI CHANNEL
213:         LDB C,PDVTIM            ; RESET HUNG COUNT
214:         DPB C,PDVCNT
215:         JRST LPTOUT             ; DO SOME MORE OUTPUTS
216: 
217: LPTCLT: HRLZI IOS,LPTERF        ; KILL THE ERROR BIT
218:         CONO PI,LPTOFF          ; WITH LPT OFF
219:         ORB IOS,LPTIOS          ; SET ERROR BIT FOR UUO-LEVEL ROUTINES TO SEE
220:         TLZ IOS,DEVSBB          ; SYSTEM BUFFER IS NO LONGER BUSY
221:         MOVEI DEVDAT,LPTDDB     ; GET DDB ADDRESS FOR SETIOD
222:         TLZE IOS,IOW            ; ARE WE IN IO WAIT?
223:         PUSHJ PDP,STTIOD        ; YES, TAKE US OUT (PUT INTO TQ)
224:         MOVEM IOS,LPTIOS        ; RESTORE IOS
225:         CONO PI,LPTON           ; RESTORE PI CHANNEL
226:         JRST CPOPJ1             ; SKIP, FORCE HNGCHK TO IGNORE US
227: 
228: LPTHN1: TRO IOS,IODERR          ;GIVE HIM A DEVICE ERROR BIT
229:         IORB IOS,LPTIOS
230:         POPJ P,
    LPTSER page# 0009 next  prev
232: ; THIS PART OF THE PROGRAM BRINGS A BUFFERLOAD INTO SYSTEM CORE
233: 
234: LPTSET: PUSHJ PDP,DEVSTU        ; SET UP COUNT AND POINTR TO POINT AT THE DATA IN HIS BUFFER
235:         JRST LPTSE2             ; THIS BUFFER HAS ALREADY BEEN EMPTIED!
236:         CAILE COUNT,LPTBLN      ; IS THE COUNT GREATER THAN THE SIZE OF THE WHOLE DAMN BUFFER?
237:         JRST BTLERR             ; YES, KILL THE BASTARD!
238:         IMULI COUNT,5           ; CHANGE WORD COUNT INTO CHARACTER COUNT
239:         MOVE A,COUNT            ; SEE IF WE CAN FIT A BUFFER IN NOW
240:         IMULI A,3               ; COMPARE FREE SPACE WITH WORST CASE
241:         CAML A,LPTCC            ; SEE IF THERE IS SPACE
242:         JRST LPTSE2             ; NO, PERFORM EXIT MAGIC
243:         PUSHJ PDP,LPTBF         ; TRANSFER DATA TO THE SYSTEM BUFFER
244:         PUSHJ PDP,ADVBFE        ; ADVANCE THE BUFFER DOWN THE RING
245:         JRST LPTSE2             ; NO MORE BUFFERS, EXIT, STAGE LEFT
246:         JRST LPTSET             ; SEE IF WE CAN SQUEEZE IN ANOTHER BUFFER
247: 
248: LPTSE2: MOVE A,LPTCC            ; SEE IF WE HAVE TRANSFERRED ANYTHING
249:         CAIGE A,5*LPTBLN-4      ; BY COMPARING WITH FULL COUNT
250:         AOS (PDP)
251:         POPJ PDP,
    LPTSER page# 0010 next  prev
253: ; TRANSFER BUFFERLOAD CHARACTER BY CHARACTER
254: ; DO CHARACTER CONVERSION IF USER WANTS IT
255: 
256: LPTBF:  SOJL COUNT,CPOPJ        ; EXIT IF COUNT IS EXHAUSTED.
257:         ILDB A,POINTR           ; PICK UP BYTE FROM USER
258:         TRNE IOS,LPTNCC         ; DOES HE WANT CONVERSION?
259:         JRST LPTB3              ; NO, SKIP IT
260: 
261:         CAIN A,134              ; IS THIS THAT GODDAMN CHARACTER?
262:         JRST LPTB2              ; YES, CUE UP TWO 177'S
263:         MOVE A,LPTCTB(A)        ; PICK UP CORRECT CHARACTER FROM CONVERT TABLE
264: LPTB1:  PUSHJ PDP,LPTDPB        ; DEPOSIT BYTE IN SYSTEM CORE
265:         JRST LPTBF
266: 
267: LPTB2:  MOVEI A,177             ; CUE UP TWO CONSEC. 177'S
268:         PUSHJ PDP,LPTDPB
269:         MOVEI A,177             ; ROUTINE DOESN'T ALWAYS PRESERVE A
270:         JRST LPTB1
271: 
272: LPTB3:  HLL A,LPTCTB(A)         ; PICK UP HIS DISPATCH BITS
273:         JRST LPTB1
    LPTSER page# 0011 next  prev
275: ; ROUTINE TO DEPOSIT ONE BYTE IN THE SYSTEM BUFFER
276: ; AND UPDATE ALL THE CRAZY COUNTS INVOLVED
277: 
278: LPTDPB: MOVE IOS,DEVIOS(DEVDAT) ; DO WE HAVE A DANGLING DELETE?
279:         TLNE IOS,LPTDNG         ; WAS LAST A SPECIAL?
280:         JRST LPTD2              ; YES!
281:         CAIE A,177              ; NO, IS THIS ONE?
282:         JRST LPTD1              ; NO, JUST REG CHAR.
283:         TLO IOS,LPTDNG          ; SET FLAG FOR NEXT TIME
284:         MOVEM IOS,DEVIOS(DEVDAT)
285:         POPJ P,
286: LPTD2:  PUSHJ PDP,LPTCCH        ; YES, SEE IS IT IS A CONTROL CHARACTER
287: LPTD1:  HLRZ D,A
288:         SKIPE D                 ; DOES THIS CHAR HAVE A DISPATCH ADDRESS?
289:         JRST LPTD7              ; YES, IT WILL TAKE CARE OF ITSELF
290:         SKIPG LPTLCC            ; NO, HAVE WE OVERFLOWED THE LINE?
291:         PUSHJ PDP,LPTMCR        ; YES, MAKE A CRLF
292: 
293: LPTD7:  TLNN IOS,LPTDNG         ; NEED WE SEND A 177 FIRST?
294:         JRST LPTD7A             ; NO
295:         PUSH P,A
296:         MOVEI A,177
297:         PUSHJ P,LPTDB           ; SEND 177
298:         POP P,A
299: LPTD7A: PUSHJ PDP,LPTDB         ; OTHERWISE, DEPOSIT CHARACTER AND UPDATE COUNTS
300:         CAIN A,11
301:         JRST LPTD11             ;SPECIAL DISPATCH FOR TAB
302:         HLRZS A                 ; PUT THE DISPATCH ADDRESS IN THE RH
303:         JUMPN A,(A)             ; STRANGE CHARACTER, DISPATCH TO SEPARATE ROUTINE
304: LPTD5A: SOS LPTLCC              ; NORMAL CHARACTER, DECREMENT COUNT
305: LPTD5:  MOVSI IOS,LPTDNG        ; ZERO OUT THE DANGLING 177 BIT
306:         ANDCAB IOS,DEVIOS(DEVDAT)
307:         POPJ PDP,
308: 
309: LPTDV:  TLNN IOS,LPTDNG         ; IS THIS A VERTICAL CHAR?
310:         JRST LPTD5              ; YES
311:         JRST LPTD5A             ; JUST ANOTHER CHAR!
312: 
313: LPTD15: TLNE IOS,LPTDNG         ; IS IT REALLY A CR
314:         JRST LPTD5A             ; NO, JUST REG CHAR.
315:         MOVEI A,LPTCPL          ; RESET COUNT TO #CHARS PER LINE
316:         MOVEM A,LPTLCC
317:         JRST LPTD5              ; EXIT, AND ZERO DANGLING 177 BIT
318: 
319: LPTD11: SOS D,LPTLCC            ; HOW FAR TO NEXT TAB STOP(AT LEAST ONE).
320:         ANDCMI D,7              ; MAYBE MORE
321:         TLNN IOS,LPTDNG         ; WHEN PRECEEDED BY 177 IS JUST GAMMA, NOT TAB
322:         MOVEM D,LPTLCC          ; THIS FAR!
323:         JRST LPTD5
324: 
    LPTSER page# 0012 next  prev
326: LPTMCR: PUSH PDP,A              ; SAVE CURRENT CHARACTER
327:         MOVEI A,15              ; MAKE A CRLF
328:         PUSHJ PDP,LPTDB
329:         MOVEI A,12
330:         PUSHJ PDP,LPTDB
331:         MOVEI A,LPTCPL          ; RESET LINE COUNT
332:         MOVEM A,LPTLCC
333:         POP PDP,A
334:         POPJ PDP,
335: 
336: LPTCCH: HRRZ D,A
337:         CAIE D,20               ;SAME AS V. TAB
338:         CAIN D,22               ;       "
339:         HRLI A,LPTD5
340:         CAIE D,23               ;       "
341:         CAIN D,24               ;       "
342:         HRLI A,LPTD5
343:         CAIN D,21               ;LINE FEED OVER PAGE BOUNDARIES
344:         HRLI A,LPTD5
345:         POPJ PDP,
    LPTSER page# 0013 next  prev
347: ; BASIC LEVEL DEPOSIT BYTE AND WRAP AROUND POINTER
348: 
349: LPTDB:  CONO PI,LPTOFF          ; SHUT OFF LINE PRINTER A SEC.
350:         MOVE B,LPTUBP           ; PICK UP BYTE POINTER
351:         IBP B                   ; INCREMENT IT
352:         HRRZ C,B                ; NOW GET ADDRESS PART
353:         CAIL C,LPTIBF+LPTBLN    ; CHECK FOR WRAP AROUND
354:         MOVE B,[POINT 7,LPTIBF,6]
355:         DPB A,B                 ; DEPOSIT THE CHARACTER
356:         MOVEM B,LPTUBP          ; REPLACE THE BYTE POINTER
357:         SOSG LPTCC              ; UPDATE CHARACTER COUNT
358:         JSP DAT,UERROR          ;BLAST THE BASTARD!
359:         CONO PI,LPTON           ; SPEED UP THE LPT
360:         POPJ PDP,
    LPTSER page# 0014 next  prev
362: ; CHARACTER CONVERSION TABLE
363: 
364: LPTCTB: XWD LPTD5,0             ; NULL, DOESN'T AFFECT POSITION ON LINE
365:         1
366:         2
367:         3
368:         4
369:         5
370:         6
371:         7
372:         10
373:         11                      ; HORIZONTAL TAB, SCREWS UP LINE POSITION
374:         XWD LPTDV,12            ; LINE FEED, DOESN'T AFFECT POSITION
375:         XWD LPTDV,13            ; VERTICAL TAB
376:         XWD LPTDV,14            ; FORM FEED
377:         XWD LPTD15,15           ; CARRIAGE RETURN, ZEROS COUNT
378:         16
379:         17
380:         20
381:         21
382:         22
383:         23
384:         24
385:         25
386:         26
387:         27
388:         137                     ; 137←30
389:         31
390:         134                     ; 134←32
391:         33
392:         34
393:         35
394:         36
395:         37
396:         40
397:         41
398:         42
399:         43
400:         44
401:         45
402:         46
403:         47
404:         50
    LPTSER page# 0015 next  prev
406: ; MORE CHARACTER TABLE, CHARACTERS 51 TO 123
407: 
408:         51
409:         52
410:         53
411:         54
412:         55
413:         56
414:         57
415:         60
416:         61
417:         62
418:         63
419:         64
420:         65
421:         66
422:         67
423:         70
424:         71
425:         72
426:         73
427:         74
428:         75
429:         76
430:         77
431:         140                     ; 140←100
432:         101
433:         102
434:         103
435:         104
436:         105
437:         106
438:         107
439:         110
440:         111
441:         112
442:         113
443:         114
444:         115
445:         116
446:         117
447:         120
448:         121
449:         122
450:         123
451: 
    LPTSER page# 0016 next  prev
453: ; MORE CHARACTER CONVERSION TABLE, CHARACTERS 124 TO 177
454: 
455:         124
456:         125
457:         126
458:         127
459:         130
460:         131
461:         132
462:         133
463:         134
464:         135
465:         32                      ; 32←136
466:         30                      ; 30←137
467:         100                     ; 100←140
468:         141
469:         142
470:         143
471:         144
472:         145
473:         146
474:         147
475:         150
476:         151
477:         152
478:         153
479:         154
480:         155
481:         156
482:         157
483:         160
484:         161
485:         162
486:         163
487:         164
488:         165
489:         166
490:         167
491:         170
492:         171
493:         172
494:         173
495:         176                     ; 176←174
496:         175
497:         175                     ; 175←176
498:         177
    LPTSER page# 0017 next  prev
500:         SUBTTL LPTSER - JAM 25 SEPT 1968 - INTERRUPT LEVEL ROUTINES
501: ; THIS PART IS ENTIRELY AUTONOMUS AND DOES NOT TRY TO
502: ; TICKLE THE USER'S CORE, BECAUSE IT ISN'T THERE!
503: 
504: LPTINT:
505:         JSR LPTSAV              ; SAVE ACCUMULATORS AND SET RETURN ADDRESS
506:         CONSZ LPT,LPTLOV        ; LINE OVERFLOW?
507:         JRST LPTLOI
508:         MOVEI DEVDAT,LPTDDB     ; SET UP DEVICE DATA BLOCK ADDRESS FOR SETIOD AND PDVTIM
509:         MOVE IOS,LPTIOS         ; LET'S SEE WHAT THE UUO-LEVEL ROUTINES ARE TRYING TO TELL US
510:         CONSZ LPT,70            ; IS THE ERROR CHANNEL DEASSIGNED?
511:         CONSO LPT,LPTDON        ; OR MAYBE THIS IS REALLY AN ERROR?
512:         JRST LPTERI             ; GO CHECK IT OUT
513:         CONSZ LPT,LPTERR        ; IS LPT TURNED OFF?
514:         JRST LPTERH             ; YES, FORCE HUNG DEVICE MESSAGE
515: 
516:         MOVE A,LPTCC            ; FIRST, IS THERE ANYTHING TO PRINT
517:         CAIL A,5*LPTBLN         ; COMPARE WITH TOTAL COUNT
518:         JRST LPTOF              ; NOTHING TO PRINT, SHUT OFF LPT
519: 
520:         SKIPN   LPTBG1          ;IS THIS THE FIRST INTERRUPT?
521:         JRST    LPTIN3          ;NO.
522:         DATAO   LPT,[BYTE (7) 15,177,20]        ;YES. HERE WE SEND A TOP OF DOUBLE FORM
523:         SETZM   LPTBG1                          ;AVOID THIS NEXT TIME
524:         JRST    LPTCF1                          ;GO DISMISS THIS INTERRUPT
525: 
526: LPTIN3: CAIE A,4*LPTBLN         ; CHECK FOR NEARLY EMPTY
527:         JRST LPTIN2             ; NOT NEARLY EMPTY, CONTINUE NORMALLY
528:         TLZE IOS,IOW            ; ARE WE IN AN IO WAIT?
529:         PUSHJ PDP,STTIOD        ; YES, GET US OUT!
530: LPTIN2: LDB C,PDVTIM            ; PICK UP HUNG COUNT TIME
531:         DPB C,PDVCNT            ; DEPOSIT IT, INITIATE HUNG COUNTING
532:         SKIPN A,LPTDCN          ; SEE IF WE TRANSMIT LESS THAN 5 CHARS THIS TIME
533:         MOVEI A,5               ; WE WILL PRINT 5 CHARACTERS
534:         SETZM LPTDCN            ; INDICATE 5 CHARACTERS NEXT TIME
535:         ADD A,LPTCC             ; ADD IN COUNT
536:         CAILE A,5*LPTBLN        ; COMPARE WITH TOTAL COUNT
537:         JRST LPTIN1             ; IF TOO LARGE, THERE IS NOT A MULTIPLE OF 5 CHARS
538:         MOVEM A,LPTCC           ; STORE CHAR. COUNT
539:         DATAO LPT,@LPTIBP       ; SEND WORD TO LINE PRINTER
540:         SETZM @LPTIBP           ; ZERO THAT WORD TO AVOID CONFUSION
541:         AOS A,LPTIBP            ; OTHERWISE THERE IS, AND WE CAN INCREMENT OUT POINTER
542:         CAIL A,LPTIBF+LPTBLN    ; CHECK FOR BUFFER OVERFLOW . . .
543:         MOVEI A,LPTIBF          ; AND RESET POINTER IF SO
544:         MOVEM A,LPTIBP          ; AND RE-STORE POINTER FOR NEXT TIME
545:         POPJ PDP,               ; SO LONG, BEEN GOOD TO SERVE YOU
    LPTSER page# 0018 next  prev
547: ; COME HERE WHEN THERE IS NOT A FULL WORD TO BE PRINTED
548: 
549: LPTIN1: TLNN IOS,LPTEN1         ; IS THIS THE LAST WORD IN BUFFER?
550:         JRST LPTOF              ; NO, FORGET IT
551:         DATAO LPT,@LPTIBP       ; SEND PARTIAL WORD
552:         SETZM @LPTIBP           ; AND ZERO IT FOR POSTERITY
553:         SUBI A,5*LPTBLN         ; GET NUMBER OF CHARS WE WILL TRANSMITT NEXT TIME
554:         MOVEM A,LPTDCN          ; PUT IT HERE FOR FUTURE REFERENCE
555:         MOVEI A,5*LPTBLN        ; RESET COUNT TO MAXIMUM
556:         MOVEM A,LPTCC
557:         POPJ PDP,               ; NO WORRY ABOUT WRAP-AROUND EITHER
    LPTSER page# 0019 next  prev
559: LPTCRF: CONO    LPT,LPTCHB+LPTDON+LPTALT        ;SET ALT FLAG
560:         DATAO   LPT,[BYTE(7) 20,177,20,177,20]  ;3 TOP OF DOUBLE FORMS
561:         SETZM   LPTBG1
562:         JRST    LPTCF1          ;NO NEED TO ADVANCE FORM AT THE START
563: 
564: LPTCF2: SETOM   LPTBG1          ; MAKE CR-FF ON NEXT OUTPUT.
565: LPTCF1: LDB     C,PDVTIM        ; PICK UP HUNG COUNT TIME, DEFINED IN LOWCOR
566:         DPB     C,PDVCNT        ; DEPOSIT IT, INITIATE HUNG COUNTING
567: LPTXIT: MOVEM   IOS,LPTIOS      ; STORE IOS IN LPT DDB
568:         POPJ    P,              ; AND EXIT, CHANNEL 5
569: 
570: LPTOF:  TLZE IOS,LPTEN2         ; HAVE WE GIVEN TERMINAL 5 FF'S
571:         JRST LPTCRF             ; GO DO IT AND RETURN IMMEDIATELY
572:         TLZE IOS,LPTEN1         ; IS THIS THE END
573:         JRST LPTCF2             ; YES - ARRANGE TO MAKE FF'S NEXT
574:         PUSHJ P,LPTERH          ; CLEAR LPT (PRESERVING DELETE BIT]
575:         TLZE IOS,IOW            ; ARE WE IN AN IO WAIT?
576:         PUSHJ PDP,STTIOD        ; YES, CHANGE TO WAIT SATISFIED!
577:         TLZ IOS,DEVSBB          ; SYSTEM BUFFER IS NO LONGER BUSY
578:         JRST LPTXIT             ; EXIT
579: 
580: ; COME HERE IF WE FIND THE LPT IS NOT ON
581: ; JUST CLEAR LPT AND WAIT FOR HUNG DEVICE MESSAGE
582: 
583: LPTERH: HLLZS LPTCON
584:         CONSZ LPT,LPTALT        ; IS DELETE FLAG CURRENTLY SET?
585:         TRO IOS,DELBIT          ; YES, REMEMBER IT!
586:         MOVEM IOS,LPTDDB+DEVIOS ; IN MEMORY TOO
587:         CONO LPT,0
588:         POPJ P,
    LPTSER page# 0020 next  prev
590: ; THIS PART HANDLES THE ERROR SYSTEM
591: 
592: LPTERI: CONSO LPT,70            ; IS THE ERROR CHANNEL ASSIGNED?
593:         JRST LPTER1             ; NO, GO REASSIGN IT AND CONTINUE
594:         MOVEI A,0               ; ASSUME NO BIT
595:         TRZE IOS,DELBIT         ; TRUE?
596:         TRO A,LPTALT            ; NO, SET BIT
597:         CONO LPT,LPTCLB+LPTDON(A); YES, DEASSIGN IT
598:         MOVEM IOS,LPTDDB+DEVIOS
599:         MOVEI A,LPTDON          ; SET TO INTERRUPT ONLY WHEN DONE
600: LPTER2: HRRM A,LPTCON           ; TELL INTERRUPT SERVICE ABOUT IT
601:         POPJ PDP,
602: 
603: LPTER1: CONI LPT,A              ; GET CURRENT CONDITIONS, EVEN THOUGH I KNOW EXACTLY WAT THEY ARE
604:         ANDI A,300              ; MASK OUT THE RIGHT ONES
605:         CONO LPT,LPTCHB(A)      ; RESTORE ALL CONO BITS
606:         MOVEI A,LPTDON+LPTERR+LPTLOV
607:         JRST LPTER2             ; AND PRETEND NOTHING EVER HAPPENED
608: 
609: LPTLOI: CONI LPT,A              ; GET LPT BITS
610:         TRZ A,LPTLOV            ; KILL LINE OVERFLOW BIT
611:         CONO LPT,(A)            ; GIVE THEM BACK
612:         DATAO LPT,[BYTE (7) 15,12]
613:         POPJ PDP,
614: 
615: BEND LPTSER
 EOF: LPTSER end-of-file. cnt=19